package zhang.abel.datapersistence.hibernate.domain;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;

@Table(name = "JOBS", schema = "HR")
@Entity
public class JobsEntity {
    private String jobId;

    @Column(name = "JOB_ID", nullable = false, insertable = true, updatable = true, length = 10, precision = 0)
    @Id
    public String getJobId() {
        return jobId;
    }

    public void setJobId(String jobId) {
        this.jobId = jobId;
    }

    private String jobTitle;

    @Column(name = "JOB_TITLE", nullable = false, insertable = true, updatable = true, length = 35, precision = 0)
    @Basic
    public String getJobTitle() {
        return jobTitle;
    }

    public void setJobTitle(String jobTitle) {
        this.jobTitle = jobTitle;
    }

    private int minSalary;

    @Column(name = "MIN_SALARY", nullable = true, insertable = true, updatable = true, length = 6, precision = 0)
    @Basic
    public int getMinSalary() {
        return minSalary;
    }

    public void setMinSalary(int minSalary) {
        this.minSalary = minSalary;
    }

    private int maxSalary;

    @Column(name = "MAX_SALARY", nullable = true, insertable = true, updatable = true, length = 6, precision = 0)
    @Basic
    public int getMaxSalary() {
        return maxSalary;
    }

    public void setMaxSalary(int maxSalary) {
        this.maxSalary = maxSalary;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        JobsEntity that = (JobsEntity) o;

        if (maxSalary != that.maxSalary) return false;
        if (minSalary != that.minSalary) return false;
        if (jobId != null ? !jobId.equals(that.jobId) : that.jobId != null) return false;
        if (jobTitle != null ? !jobTitle.equals(that.jobTitle) : that.jobTitle != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = jobId != null ? jobId.hashCode() : 0;
        result = 31 * result + (jobTitle != null ? jobTitle.hashCode() : 0);
        result = 31 * result + minSalary;
        result = 31 * result + maxSalary;
        return result;
    }
}
